﻿
@{
    ViewBag.Title = "组件详情";
    Layout = "~/Views/Shared/_LayoutPage.cshtml";
}
@model IOA.MES.DataAccess.VModel.VComponent

@section Contents{
    <style>
        .layui-input-inline {
            padding: 6px 0 !important;
        }
    </style>
}

<div id="page"></div>

<script type="text/template" id="tplPage">
    <div style="padding: 20px; background-color: #F2F2F2;">
        <div class="layui-card">
            <div class="layui-card-body">
                <div class="layui-row">
                    <div class="layui-col-xs4 layui-inline">
                        <label class="layui-form-label" v-html="lang.Field.BarCode">组件条码：</label>
                        <div class="layui-input-inline">
                            @Model.BarCode
                        </div>
                    </div>
                    <div class="layui-col-xs4 layui-inline">
                        <label class="layui-form-label" v-html="lang.Field.OrderNo">订单号：</label>
                        <div class="layui-input-inline">
                            @Model.OrderNo
                        </div>
                    </div>
                    <div class="layui-col-xs4 layui-inline">
                        <label class="layui-form-label" v-html="lang.Field.WorkorderNo">工单号：</label>
                        <div class="layui-input-inline">
                            @Model.WorkOrderNo
                        </div>
                    </div>
                </div>
                <div class="layui-row">
                    <div class="layui-col-xs4 layui-inline">
                        <label class="layui-form-label" v-html="lang.Field.CreateTime">创建时间：</label>
                        <div class="layui-input-inline">
                            @Model.CreateTime.ToString("yyyy-MM-dd HH:mm:ss")
                        </div>
                    </div>
                    <div class="layui-col-xs4 layui-inline">
                        <label class="layui-form-label" v-html="lang.Field.CustomerCode">客户代码：</label>
                        <div class="layui-input-inline">
                            @Model.CustomerCode
                        </div>
                    </div>
                    <div class="layui-col-xs4 layui-inline">
                        <label class="layui-form-label" v-html="lang.Field.CustomerName">客户名称：</label>
                        <div class="layui-input-inline">
                            @Model.CustomerName
                        </div>
                    </div>
                </div>
                <div class="layui-row">
                    <div class="layui-col-xs4 layui-inline">
                        <label class="layui-form-label" v-html="lang.Field.FinishedProductCode">成品料号：</label>
                        <div class="layui-input-inline">
                            @Model.ProductCode
                        </div>
                    </div>
                    <div class="layui-col-xs4 layui-inline">
                        <label class="layui-form-label" v-html="lang.Field.FinishedProductName">成品名称：</label>
                        <div class="layui-input-inline">
                            @Model.ProductName
                        </div>
                    </div>
                    <div class="layui-col-xs4 layui-inline">
                        <label class="layui-form-label" v-html="lang.Field.WorkShop">生产车间：</label>
                        <div class="layui-input-inline">
                            @Model.WorkshopName
                        </div>
                    </div>
                </div>
                <div class="layui-row">
                    <div class="layui-col-xs4 layui-inline">
                        <label class="layui-form-label" v-html="lang.Field.NameplateModel">铭牌方案：</label>
                        <div class="layui-input-inline">
                            @Model.NameplateModel
                        </div>
                    </div>
                    <div class="layui-col-xs4 layui-inline">
                        <label class="layui-form-label" v-html="lang.Field.PowerLevel">功率档：</label>
                        <div class="layui-input-inline">
                            @Model.IVPowerLevel
                        </div>
                    </div>
                    <div class="layui-col-xs4 layui-inline">
                        <label class="layui-form-label" v-html="lang.Field.CurrentLevel">电流档：</label>
                        <div class="layui-input-inline">
                            @Model.IVCurrentLevel
                        </div>
                    </div>
                </div>
                <div class="layui-row">
                    <div class="layui-col-xs4 layui-inline">
                        <label class="layui-form-label" v-html="lang.Field.Efficiency">效率：</label>
                        <div class="layui-input-inline">
                            @Model.CellEfficiency
                        </div>
                    </div>
                    <div class="layui-col-xs4 layui-inline">
                        <label class="layui-form-label" v-html="lang.Field.CellColor">电池片颜色：</label>
                        <div class="layui-input-inline">
                            @Model.CellColor
                        </div>
                    </div>
                    <div class="layui-col-xs4 layui-inline">
                        <label class="layui-form-label" v-html="lang.Field.ComponentColor">组件颜色：</label>
                        <div class="layui-input-inline">
                            @Model.ComponentColor
                        </div>
                    </div>
                </div>
                <div class="layui-row">
                    <div class="layui-col-xs4 layui-inline">
                        <label class="layui-form-label" v-html="lang.Field.DistributeTime">分片时间：</label>
                        <div class="layui-input-inline">
                            @(Model.DistributeTime?.ToString("yyyy-MM-dd HH:mm:ss"))
                        </div>
                    </div>
                    <div class="layui-col-xs4 layui-inline">
                        <label class="layui-form-label" v-html="lang.Field.PackBatchNo">打包批次号：</label>
                        <div class="layui-input-inline">
                            @Model.PackBatchNo
                        </div>
                    </div>
                    <div class="layui-col-xs4 layui-inline">
                        <label class="layui-form-label" v-html="lang.Field.PackNo">打包编号：</label>
                        <div class="layui-input-inline">
                            @Model.PackNo
                        </div>
                    </div>
                </div>
                <div class="layui-row">
                    <div class="layui-col-xs4 layui-inline">
                        <label class="layui-form-label" v-html="lang.Field.PackTime">打包时间：</label>
                        <div class="layui-input-inline">
                            @(Model.PackTime?.ToString("yyyy-MM-dd HH:mm:ss"))
                        </div>
                    </div>
                    <div class="layui-col-xs4 layui-inline">
                        <label class="layui-form-label" v-html="lang.Field.CabinetNo">柜号：</label>
                        <div class="layui-input-inline">
                            @Model.CabinetNo
                        </div>
                    </div>
                    <div class="layui-col-xs4 layui-inline">
                        <label class="layui-form-label" v-html="lang.Field.WarehouseName">仓库：</label>
                        <div class="layui-input-inline">
                            @Model.WarehouseName
                        </div>
                    </div>
                </div>
                <div class="layui-row">
                    <div class="layui-col-xs4 layui-inline">
                        <label class="layui-form-label" v-html="lang.Field.Location">库位：</label>
                        <div class="layui-input-inline">
                            @Model.Location
                        </div>
                    </div>
                    <div class="layui-col-xs4 layui-inline">
                        <label class="layui-form-label" v-html="lang.Field.InboundTime">入库时间：</label>
                        <div class="layui-input-inline">
                            @(Model.InboundTime?.ToString("yyyy-MM-dd HH:mm:ss"))
                        </div>
                    </div>
                    <div class="layui-col-xs4 layui-inline">
                        <label class="layui-form-label" v-html="lang.Field.OutboundTime">出库时间：</label>
                        <div class="layui-input-inline">
                            @(Model.OutboundTime?.ToString("yyyy-MM-dd HH:mm:ss"))
                        </div>
                    </div>
                </div>
                <div class="layui-row">
                    <div class="layui-col-xs4 layui-inline">
                        <label class="layui-form-label" v-html="lang.Field.LoadTime">上车时间：</label>
                        <div class="layui-input-inline">
                            @(Model.LoadTime?.ToString("yyyy-MM-dd HH:mm:ss"))
                        </div>
                    </div>
                </div>
            </div>
        </div>
        <div class="layui-card">
            <div class="layui-card-header">
                焊接数据
            </div>
            <div class="layui-card-body">
                <table id="tableWelding" lay-filter="tableWelding"></table>
            </div>
        </div>
        <div class="layui-card">
            <div class="layui-card-header">
                层压数据
            </div>
            <div class="layui-card-body">
                <table id="tableTop" lay-filter="tableTop"></table>
            </div>
        </div>
        <div class="layui-card">
            <div class="layui-card-header">
                IV数据
            </div>
            <div class="layui-card-body">
                <table id="tableIV" lay-filter="tableIV"></table>
            </div>
        </div>
        <div class="layui-card">
            <div class="layui-card-header">
                绝缘耐压数据
            </div>
            <div class="layui-card-body">
                <table id="tableInsulate" lay-filter="tableInsulate"></table>
            </div>
        </div>
        <div class="layui-card">
            <div class="layui-card-header">
                图片数据
            </div>
            <div class="layui-card-body">
                <table id="tableImages" lay-filter="tableImages"></table>
            </div>
        </div>
        <div class="layui-card">
            <div class="layui-card-header">
                操作记录
            </div>
            <div class="layui-card-body">
                <table id="tableOprLog" lay-filter="tableOprLog"></table>
            </div>
        </div>
    </div>
</script>

@section Scripts{
    <script>
        var vm = new Vue({
            el: "#page",
            template: "#tplPage",
            data: {
                lang: JSON.parse(lang).package,
                barCode: "@Model.BarCode"
            }
        });

        setTimeout(function () {
            initLayui();
        }, 50);
        function initLayui() {
            layui.use(['form', 'layer', 'index', 'table'], function () {
                var table = layui.table;

                var oprLogOptions = {
                    elem: '#tableOprLog'
                    , url: '/Report/QueryOprLogs'
                    , method: "post"
                    , where: { subjectType: "组件", subjectNo: vm.$data.barCode }
                    , page: false
                    , limit: 1000
                    , response: {
                        statusName: 'ErrCode'
                        , statusCode: 200
                        , msgName: 'ErrCode'
                        , countName: 'TotalCount'
                        , dataName: 'Data'
                    }
                    , cols: [[
                        { title: '序号', type: "numbers", width: 60, fixed: "left" }
                        , { field: 'OpeatorName', title: '操作人', width: 100, fixed: "left" }
                        , { field: 'LogTimeStr', title: '操作时间', width: 180 }
                        , { field: 'LogName', title: '操作类型', width: 100 }
                        , {
                            title: '操作状态', width: 100, templet: function (d) {
                                return "<span style='color:" + (d.LogStatus == "正常" ? "#009688" : "#FF5722") + "'>" + d.LogStatus + "</span>";
                            }
                        }
                        , { field: 'LogContent', title: '操作内容', minWidth: 150 }
                    ]]
                };
                table.render(oprLogOptions);

                var weldingOptions = {
                    elem: '#tableWelding'
                    , url: '/Report/QueryWeldingDatas'
                    , method: "post"
                    , where: { barCode: vm.$data.barCode }
                    , page: false
                    , limit: 1000
                    , response: {
                        statusName: 'ErrCode'
                        , statusCode: 200
                        , msgName: 'ErrCode'
                        , countName: 'TotalCount'
                        , dataName: 'Data'
                    }
                    , cols: [[
                        { title: '序号', type: "numbers", width: 60 }
                        , { field: 'CreateTimeStr', title: '过站时间', width: 170 }
                        , { field: 'PreHeat1A', title: 'PreHeat1A', minWidth: 100 }
                        , { field: 'PreHeat1B', title: 'PreHeat1B', minWidth: 100 }
                        , { field: 'PreHeat2A', title: 'PreHeat2A', minWidth: 100 }
                        , { field: 'PreHeat2B', title: 'PreHeat2B', minWidth: 100 }
                        , { field: 'PreHeat3A', title: 'PreHeat3A', minWidth: 100 }
                        , { field: 'PreHeat3B', title: 'PreHeat3B', minWidth: 100 }
                        , { field: 'SolderTemp1A', title: 'SolderTemp1A', minWidth: 100 }
                        , { field: 'SolderTemp1B', title: 'SolderTemp1B', minWidth: 100 }
                        , { field: 'SolderTemp2A', title: 'SolderTemp2A', minWidth: 100 }
                        , { field: 'SolderTemp2B', title: 'SolderTemp2B', minWidth: 100 }
                        , { field: 'Cool1A', title: 'Cool1A', minWidth: 100 }
                        , { field: 'Cool1B', title: 'Cool1B', minWidth: 100 }
                        , { field: 'Cool2A', title: 'Cool2A', minWidth: 100 }
                        , { field: 'Cool2B', title: 'Cool2B', minWidth: 100 }
                        , { field: 'Cool3A', title: 'Cool3A', minWidth: 100 }
                        , { field: 'Cool3B', title: 'Cool3B', minWidth: 100 }
                        , { field: 'Cool4A', title: 'Cool4A', minWidth: 100 }
                        , { field: 'Cool4B', title: 'Cool4B', minWidth: 100 }
                        , { field: 'FluxTempA', title: 'FluxTempA', minWidth: 100 }
                        , { field: 'FluxTempB', title: 'FluxTempB', minWidth: 100 }
                        , { field: 'SolderPowerFroA', title: 'SolderPowerFroA', minWidth: 100 }
                        , { field: 'SolderPowerFroB', title: 'SolderPowerFroB', minWidth: 100 }
                        , { field: 'SolderTimeFroA', title: 'SolderTimeFroA', minWidth: 100 }
                        , { field: 'SolderTimeFroB', title: 'SolderTimeFroB', minWidth: 100 }
                        , { field: 'SolderTempFroA', title: 'SolderTempFroA', minWidth: 100 }
                        , { field: 'SolderTempFroB', title: 'SolderTempFroB', minWidth: 100 }
                        , { field: 'FullData', title: '原始数据', minWidth: 100 }
                    ]]
                };
                table.render(weldingOptions);

                var topOptions = {
                    elem: '#tableTop'
                    , url: '/Report/QueryTopDatas'
                    , method: "post"
                    , where: { barCode: vm.$data.barCode }
                    , page: false
                    , limit: 1000
                    , response: {
                        statusName: 'ErrCode'
                        , statusCode: 200
                        , msgName: 'ErrCode'
                        , countName: 'TotalCount'
                        , dataName: 'Data'
                    }
                    , cols: [[
                        { field: 'MachineName', title: '设备名称', minWidth: 100 }
                        , { field: 'Layer', title: '层', minWidth: 100 }
                        , { field: 'Cavity', title: '腔体', minWidth: 100 }
                        , { field: 'CnWorkingStatus', title: '工作状态', minWidth: 100 }
                        , { field: 'TableAvgTemp', title: '台面平均温度', minWidth: 100 }
                        , { field: 'UpperVacuum', title: '上真空温度', minWidth: 100 }
                        , { field: 'DownVacuum', title: '下真空温度', minWidth: 100 }
                        , { field: 'OilTankTemp', title: '油箱温度', minWidth: 100 }
                        , { field: 'DownVacuumPsg', title: '下真空PSG值', minWidth: 100 }
                        , { field: 'Temp1', title: '温度1', minWidth: 100 }
                        , { field: 'Temp2', title: '温度2', minWidth: 100 }
                        , { field: 'Temp3', title: '温度3', minWidth: 100 }
                        , { field: 'Temp4', title: '温度4', minWidth: 100 }
                        , { field: 'Temp5', title: '温度5', minWidth: 100 }
                        , { field: 'CreateTimeStr', title: '数据时间', minWidth: 100 }
                    ]]
                };
                table.render(topOptions);

                var ivOptions = {
                    elem: '#tableIV'
                    , url: '/Report/QueryIvDatas'
                    , method: "post"
                    , where: { barCode: vm.$data.barCode }
                    , page: false
                    , limit: 1000
                    , response: {
                        statusName: 'ErrCode'
                        , statusCode: 200
                        , msgName: 'ErrCode'
                        , countName: 'TotalCount'
                        , dataName: 'Data'
                    }
                    , cols: [[
                        { title: '序号', type: "numbers", width: 60 }
                        , { field: 'CreateTimeStr', title: '过站时间', width: 170 }
                        , { field: 'IVPowerLevel', title: '功率档', minWidth: 100 }
                        , { field: 'IVCurrentLevel', title: '电流档', minWidth: 100 }
                        , { field: 'Temp', title: 'Temp', minWidth: 100 }
                        , { field: 'CkTemp', title: 'CkTemp', minWidth: 100 }
                        , { field: 'EnvTemp', title: 'EnvTemp', minWidth: 100 }
                        , { field: 'Voc', title: 'Voc', minWidth: 100 }
                        , { field: 'Isc', title: 'Isc', minWidth: 100 }
                        , { field: 'Pmax', title: 'Pmax', minWidth: 100 }
                        , { field: 'Vm', title: 'Vm', minWidth: 100 }
                        , { field: 'Im', title: 'Im', minWidth: 100 }
                        , { field: 'FF', title: 'FF', minWidth: 100 }
                        , { field: 'NCell', title: 'NCell', minWidth: 100 }
                        , { field: 'Ress', title: 'Ress', minWidth: 100 }
                        , { field: 'Ressh', title: 'Ressh', minWidth: 100 }
                        , { field: 'TestTime', title: 'TestTime', minWidth: 100 }
                        , { field: 'NModule', title: 'NModule', minWidth: 100 }
                        , { field: 'Rank', title: 'Rank', minWidth: 100 }
                        , { field: 'ModEff', title: 'ModEff', minWidth: 100 }
                        , { field: 'TMod', title: 'TMod', minWidth: 100 }
                        , { field: 'Insol', title: 'Insol', minWidth: 100 }
                        , { field: 'SunRef', title: 'SunRef', minWidth: 100 }
                        , { field: 'Irev', title: 'Irev', minWidth: 100 }
                        , { field: 'Ivld', title: 'Ivld', minWidth: 100 }
                        , { field: 'Vld', title: 'Vld', minWidth: 100 }
                        , { field: 'StdIsc', title: 'StdIsc', minWidth: 100 }
                        , { field: 'Manuf', title: 'Manuf', minWidth: 100 }
                        , { field: 'Pvld', title: 'Pvld', minWidth: 100 }
                        , { field: 'ModType', title: 'ModType', minWidth: 100 }
                        , { field: 'Area', title: 'Area', minWidth: 100 }
                        , { field: 'Jsc', title: 'Jsc', minWidth: 100 }
                        , { field: 'RCTemp', title: 'RCTemp', minWidth: 100 }
                        , { field: 'STime', title: 'STime', minWidth: 100 }
                        , { field: 'SDirection', title: 'SDirection', minWidth: 100 }
                        , { field: 'IrrCali', title: 'IrrCali', minWidth: 100 }
                    ]]
                };
                table.render(ivOptions);

                var insulateOptions = {
                    elem: '#tableInsulate'
                    , url: '/Report/QueryInsulateDatas'
                    , method: "post"
                    , where: { barCode: vm.$data.barCode }
                    , page: false
                    , limit: 1000
                    , response: {
                        statusName: 'ErrCode'
                        , statusCode: 200
                        , msgName: 'ErrCode'
                        , countName: 'TotalCount'
                        , dataName: 'Data'
                    }
                    , cols: [[
                        { title: '序号', type: "numbers", width: 60 }
                        , { field: 'CreateTimeStr', title: '过站时间', width: 170 }
                        , { field: 'Position', title: '工位', minWidth: 100 }
                        , { field: 'Result', title: '总结果', minWidth: 100 }
                        , { field: 'StartTime', title: '开始时间', minWidth: 100 }
                        , { field: 'EndTime', title: '结束时间', minWidth: 100 }
                        , { field: 'TestDuring', title: '总耗时', minWidth: 100 }
                        , { field: 'Param1', title: 'M1测试项', minWidth: 100 }
                        , { field: 'Param1Setting1', title: 'M1设置1值', minWidth: 100 }
                        , { field: 'Param1Test1', title: 'M1测试1值', minWidth: 100 }
                        , { field: 'Param1Test2', title: 'M1测试2值', minWidth: 100 }
                        , { field: 'Param1Test2Max', title: 'M1设置2值上限', minWidth: 100 }
                        , { field: 'Param1Test2Min', title: 'M1设置2值下限', minWidth: 100 }
                        , { field: 'Param1Result', title: 'M1测试结果', minWidth: 100 }
                        , { field: 'Param2', title: 'M2测试项', minWidth: 100 }
                        , { field: 'Param2Setting1', title: 'M2设置1值', minWidth: 100 }
                        , { field: 'Param2Test1', title: 'M2测试1值', minWidth: 100 }
                        , { field: 'Param2Test2', title: 'M2测试2值', minWidth: 100 }
                        , { field: 'Param2Test2Max', title: 'M2设置2值上限', minWidth: 100 }
                        , { field: 'Param2Test2Min', title: 'M2设置2值下限', minWidth: 100 }
                        , { field: 'Param2Result', title: 'M2测试结果', minWidth: 100 }
                        , { field: 'Param3', title: 'M3测试项', minWidth: 100 }
                        , { field: 'Param3Setting1', title: 'M3设置1值', minWidth: 100 }
                        , { field: 'Param3Test1', title: 'M3测试1值', minWidth: 100 }
                        , { field: 'Param3Test2', title: 'M3测试2值', minWidth: 100 }
                        , { field: 'Param3Test2Max', title: 'M3设置2值上限', minWidth: 100 }
                        , { field: 'Param3Test2Min', title: 'M3设置2值下限', minWidth: 100 }
                        , { field: 'Param3Result', title: 'M3测试结果', minWidth: 100 }
                        , { field: 'Param4', title: 'M4测试项', minWidth: 100 }
                        , { field: 'Param4Setting1', title: 'M4设置1值', minWidth: 100 }
                        , { field: 'Param4Test1', title: 'M4测试1值', minWidth: 100 }
                        , { field: 'Param4Test2', title: 'M4测试2值', minWidth: 100 }
                        , { field: 'Param4Test2Max', title: 'M4设置2值上限', minWidth: 100 }
                        , { field: 'Param4Test2Min', title: 'M4设置2值下限', minWidth: 100 }
                        , { field: 'Param4Result', title: 'M4测试结果', minWidth: 100 }
                    ]]
                };
                table.render(insulateOptions);

                var imageOptions = {
                    elem: '#tableImages'
                    , url: '/Report/QueryViaSiteImages'
                    , method: "post"
                    , where: { barCode: vm.$data.barCode }
                    , page: false
                    , limit: 1000
                    , response: {
                        statusName: 'ErrCode'
                        , statusCode: 200
                        , msgName: 'ErrCode'
                        , countName: 'TotalCount'
                        , dataName: 'Data'
                    }
                    , cols: [[
                        { title: '序号', type: "numbers", width: 60 }
                        , { field: 'CreateTimeStr', title: '过站时间', width: 170 }
                        , { field: 'CNSiteType', title: '过站类型', width: 150 }
                        , {
                            title: '过站图片', minWidth: 170, templet: function (d) {
                                return d.Image == "" ? "" : "<a target='blank' href='/Common/GetImage?url=" + encodeURIComponent(d.Image) + "'><image src='/Common/GetImage?url=" + encodeURIComponent(d.Image) + "'/></a>";
                            }
                        }
                        , {
                            title: '异常位置', minWidth: 150, templet: function (d) {
                                return d.Positions == '' ? '' : JSON.parse(d.Positions).map((item) => item.Name + (item.Name == 'OK' ? "" : ("：" + item.Position))).join("；");
                            }
                        }
                    ]]
                };
                table.render(imageOptions);
            });
        }
    </script>
}
